package com.ff.discounts.fragment

import com.ff.discounts.activity.BaseLogicActivity
import com.ff.discounts.model.BaseViewModel

/**
 *
 * @author: fufang
 * @date: 2023/10/17
 */
abstract class BaseLogicFragment:BaseCommonFragment() {
    /**
     * 获取界面方法
     *
     * @return
     */
    protected val hostActivity: com.ff.discounts.activity.BaseLogicActivity
        protected get() = requireActivity() as com.ff.discounts.activity.BaseLogicActivity

    /**
     * 初始化通用ViewModel 逻辑
     */
    fun initViewModel(viewModel: BaseViewModel){
        // 关闭界面
        viewModel.finishPage.observe(this){
            hostActivity.finish()
        }
    }
}